<html>
<head><meta charset="utf-8"><title>Generate Documentation PDF · new members · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/122652-new-members/index.html">new members</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/122652-new-members/topic/Generate.20Documentation.20PDF.html">Generate Documentation PDF</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="216089681"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122652-new%20members/topic/Generate%20Documentation%20PDF/near/216089681" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonatan Hatakeyama Zeidler <a href="https://rust-lang.github.io/zulip_archive/stream/122652-new-members/topic/Generate.20Documentation.20PDF.html#216089681">(Nov 09 2020 at 14:23)</a>:</h4>
<p>Hi there, any idea how I could generate a PDF out of the rust comments within the code? It seems rustdoc can only generate a website. I tried wkhtmltopdf on make that a PDF, but the result gets quite messy. If there was a way to generate some structure representation like json, I could figure something out with some script + latex. But even that does not seem to be possible any more. Any ideas?</p>



<a name="216089932"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122652-new%20members/topic/Generate%20Documentation%20PDF/near/216089932" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/122652-new-members/topic/Generate.20Documentation.20PDF.html#216089932">(Nov 09 2020 at 14:24)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/pull/75114">https://github.com/rust-lang/rust/pull/75114</a> will add a json backend to rustdoc.</p>



<a name="216090969"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122652-new%20members/topic/Generate%20Documentation%20PDF/near/216090969" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonatan Hatakeyama Zeidler <a href="https://rust-lang.github.io/zulip_archive/stream/122652-new-members/topic/Generate.20Documentation.20PDF.html#216090969">(Nov 09 2020 at 14:30)</a>:</h4>
<p>Oh, that is awesome! I guess to test it I would need to build rust from that branch? Or is there some build server that does that automatically for all PRs?</p>



<a name="216095786"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122652-new%20members/topic/Generate%20Documentation%20PDF/near/216095786" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/122652-new-members/topic/Generate.20Documentation.20PDF.html#216095786">(Nov 09 2020 at 15:03)</a>:</h4>
<p>There hasn't been a try build for it. These can be done using <code>@bors try</code> when you have the permission to accept a PR. When one is done you can use <a href="https://github.com/kennytm/rustup-toolchain-install-master"><code>rustup-toolchain-install-master</code></a> to install it. For now you will have to build it yourself using <code>./x.py build src/tools/rustdoc</code>. If you are on Linux you can add the following to a new file called <code>config.toml</code> in your rust clone to avoid building LLVM:</p>
<div class="codehilite" data-code-language="TOML"><pre><span></span><code><span class="k">[llvm]</span>
<span class="n">download-ci-llvm</span> <span class="o">=</span> <span class="kc">true</span>
</code></pre></div>



<a name="216097207"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122652-new%20members/topic/Generate%20Documentation%20PDF/near/216097207" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonatan Hatakeyama Zeidler <a href="https://rust-lang.github.io/zulip_archive/stream/122652-new-members/topic/Generate.20Documentation.20PDF.html#216097207">(Nov 09 2020 at 15:14)</a>:</h4>
<p>I am already building the whole tool chain for half an hour now. How many hours this is expected to take? If it took many hours I would cancel and do as you suggested to just build rustdoc. Thanks for your help, already!</p>



<a name="216099962"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122652-new%20members/topic/Generate%20Documentation%20PDF/near/216099962" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122652-new-members/topic/Generate.20Documentation.20PDF.html#216099962">(Nov 09 2020 at 15:33)</a>:</h4>
<p><span class="user-mention" data-user-id="363071">@Jonatan Hatakeyama Zeidler</span> Yes, just build rustdoc. The progress is cached so you won't lose work.</p>



<a name="216100043"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122652-new%20members/topic/Generate%20Documentation%20PDF/near/216100043" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122652-new-members/topic/Generate.20Documentation.20PDF.html#216100043">(Nov 09 2020 at 15:33)</a>:</h4>
<p><span class="user-mention" data-user-id="116883">@tmandry</span> see, I told you people were queuing up to use it :P</p>



<a name="216100580"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122652-new%20members/topic/Generate%20Documentation%20PDF/near/216100580" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122652-new-members/topic/Generate.20Documentation.20PDF.html#216100580">(Nov 09 2020 at 15:36)</a>:</h4>
<p>Oh and libstd too - <code>x.py build src/tools/rustdoc library/std</code></p>



<a name="216111752"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122652-new%20members/topic/Generate%20Documentation%20PDF/near/216111752" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonatan Hatakeyama Zeidler <a href="https://rust-lang.github.io/zulip_archive/stream/122652-new-members/topic/Generate.20Documentation.20PDF.html#216111752">(Nov 09 2020 at 16:51)</a>:</h4>
<p>The rustdoc build from that branch still gives me a <code>error: json output format isn't supported for doc generation</code> when running it with <code>-w json</code>. <span aria-label="thinking" class="emoji emoji-1f914" role="img" title="thinking">:thinking:</span></p>



<a name="216112606"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122652-new%20members/topic/Generate%20Documentation%20PDF/near/216112606" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122652-new-members/topic/Generate.20Documentation.20PDF.html#216112606">(Nov 09 2020 at 16:57)</a>:</h4>
<p><span class="user-mention" data-user-id="363071">@Jonatan Hatakeyama Zeidler</span> try <code>--output-format json</code></p>



<a name="216112886"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122652-new%20members/topic/Generate%20Documentation%20PDF/near/216112886" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonatan Hatakeyama Zeidler <a href="https://rust-lang.github.io/zulip_archive/stream/122652-new-members/topic/Generate.20Documentation.20PDF.html#216112886">(Nov 09 2020 at 16:59)</a>:</h4>
<p>Same result. <code>-w</code> is short for <code>--output-format</code>.</p>



<a name="216113024"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122652-new%20members/topic/Generate%20Documentation%20PDF/near/216113024" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122652-new-members/topic/Generate.20Documentation.20PDF.html#216113024">(Nov 09 2020 at 17:00)</a>:</h4>
<p>are you sure you're using the right version of rustdoc? that works fine for me locally</p>



<a name="216113430"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122652-new%20members/topic/Generate%20Documentation%20PDF/near/216113430" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonatan Hatakeyama Zeidler <a href="https://rust-lang.github.io/zulip_archive/stream/122652-new-members/topic/Generate.20Documentation.20PDF.html#216113430">(Nov 09 2020 at 17:03)</a>:</h4>
<p>I am directly running the binary in <code>~/rust/build/x86_64-unknown-linux-gnu/stage0/bin/rustdoc</code> (the branch from the PR) with cwd in my create's directory, appending the arguments <code>cargo rustdoc</code> would add, plus the <code>--output-format</code>.</p>



<a name="216113609"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122652-new%20members/topic/Generate%20Documentation%20PDF/near/216113609" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122652-new-members/topic/Generate.20Documentation.20PDF.html#216113609">(Nov 09 2020 at 17:04)</a>:</h4>
<p>stage0 is the beta rustdoc</p>



<a name="216113627"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122652-new%20members/topic/Generate%20Documentation%20PDF/near/216113627" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122652-new-members/topic/Generate.20Documentation.20PDF.html#216113627">(Nov 09 2020 at 17:04)</a>:</h4>
<p>you want <a href="https://rustc-dev-guide.rust-lang.org/building/how-to-build-and-run.html?highlight=rustup,link#creating-a-rustup-toolchain">https://rustc-dev-guide.rust-lang.org/building/how-to-build-and-run.html?highlight=rustup,link#creating-a-rustup-toolchain</a></p>



<a name="216113686"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122652-new%20members/topic/Generate%20Documentation%20PDF/near/216113686" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122652-new-members/topic/Generate.20Documentation.20PDF.html#216113686">(Nov 09 2020 at 17:05)</a>:</h4>
<p>and also consider reading through <a href="https://rustc-dev-guide.rust-lang.org/building/bootstrapping.html">https://rustc-dev-guide.rust-lang.org/building/bootstrapping.html</a></p>



<a name="216113907"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122652-new%20members/topic/Generate%20Documentation%20PDF/near/216113907" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122652-new-members/topic/Generate.20Documentation.20PDF.html#216113907">(Nov 09 2020 at 17:06)</a>:</h4>
<p><span class="user-mention" data-user-id="363071">@Jonatan Hatakeyama Zeidler</span> ^</p>



<a name="216119329"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122652-new%20members/topic/Generate%20Documentation%20PDF/near/216119329" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonatan Hatakeyama Zeidler <a href="https://rust-lang.github.io/zulip_archive/stream/122652-new-members/topic/Generate.20Documentation.20PDF.html#216119329">(Nov 09 2020 at 17:46)</a>:</h4>
<p>That was exactly what I needed to know. It works fine for me now. Thank you both a lot! <span aria-label="smile" class="emoji emoji-1f642" role="img" title="smile">:smile:</span></p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>